package com.ecloud.scheduler.config;

import com.ecloud.common.standard.EnableProp;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * @author Squbi
 */
@Configuration
@ConfigurationProperties("scheduler")
@Data
public class SchedulerProperties implements EnableProp {
    private String instanceName;
    private boolean export;
    private boolean proxy;
    private boolean executionTransaction;

    @Override
    public Properties toProperties() {
        Properties prop = new Properties();
        prop.put("org.quartz.scheduler.instanceName", instanceName);
        prop.put("org.quartz.scheduler.rmi.export", export);
        prop.put("org.quartz.scheduler.rmi.proxy", proxy);
        prop.put("org.quartz.scheduler.wrapJobExecutionInUserTransaction", executionTransaction);
        return prop;
    }
}
